import { Component, Vue, Prop, Watch } from 'vue-property-decorator';

@Component({})
export default class TeamPop extends Vue {
  private title: string = 'TeamPop';
  private selectedTeam: { teamName: string; teamId: number } = {
    teamName: '',
    teamId: 0
  };

  @Prop()
  private teamList: any[] | undefined;

  @Watch('teamList')
  private watchTeamList() {
    this.getActiveTeam();
  }

  // 获取激活的团队
  private getActiveTeam() {
    if (this.teamList) {
      this.teamList.forEach(item => {
        if (item.teamStatus === 1) {
          this.selectedTeam.teamId = item.id;
          this.selectedTeam.teamName = item.teamName;
        }
      });
    }
  }

  // 切换团队
  private selectedItem(item: any) {}

  private created() {
    this.getActiveTeam();
  }
}
